﻿using System.Collections.Generic;
using System.Linq;
using LINQtoFxCop.Core;

namespace LINQtoFxCop.Flaws.Design
{
  internal sealed class DesignOverridesEqualsButNotGetHashCode : FlawsIntrospectionRule
  {
    public DesignOverridesEqualsButNotGetHashCode()
      : base("DesignOverridesEqualsButNotGetHashCode")
    { }

    protected override IEnumerable<QueryResult> Query()
    {
      return
        from @class in Classes
        where @class.OverridesEquals() && !@class.OverridesGetHashCode()
        select Result(@class);
    }
  }
}